var h = window.innerHeight;
var qzbhs = '',
    xxid = '',
    ajmc = '',
    ajbh = '',
    xh = '',
    line = 1,
    Obj = '',//获取某一项信息
    peoplePhoto = '',//嫌疑人头像
    imgNum = $('#allImg img').length,
    imgW = $('.infoR').width(),
    isSsow = true,
    hideClue = '';
$(document).ready(function() {
    $('.row-hook').css({height: h});
    $('.tab-1').css('height',h - 62 + 'px');
    $('.listDiv').css({height: h - 150 + 'px',overflow: 'auto'});
    $('.introCase').css('height',$('.listDiv').height() - $('.minH').height() - 5 + 'px');
    $('.case-list').css('height', $('#case').height() - 33 + 'px');
    //附件查看
    $('#fileImg').css({width:$('.infoL').width() - 500 + 'px',overflow: 'hidden'});

    //上传
    $('.fileContainer').css('width',$('.fileEnclosures').width() - 35 + 'px');
    $('#yulan').css({width:$('.fileEnclosures .left').width() - 5 + 'px', height: $('.fileEnclosures .left').height() + 'px'});
    $('#canvasShow').css({width:$('.fileEnclosures .left').width() - 5 + 'px', height: $('.fileEnclosures .left').height() + 'px'});
    $('.allMessageList').css('width',$('.fileEnclosures .right').width() + 'px');
    //案件自动查询
    btnClick($('.groupNew button').eq(1), '1');
    textareaOnload();
    $(window).resize(function(){
        h = window.innerHeight;
        $('.row-hook').css({height: h});
        $('.tab-1').css('height',50 + 'px');
        $('.listDiv').css({height: h - 150 + 'px',overflow: 'auto'});
        $('.tab-3').css('height',50 + 'px');
        $('.tab-' + line).css('height',h - 62 + 'px');
        if(line == 1){
            $('.tab-1').find('.arrowDirection').attr('src','thread/img/down.png');
            $('.tab-3').find('.arrowDirection').attr('src','thread/img/right.png');
        } else{
            $('.tab-3').find('.arrowDirection').attr('src','thread/img/down.png');
            $('.tab-1').find('.arrowDirection').attr('src','thread/img/right.png');
        }
        $('.listDiv').css({height: h - 150 + 'px',overflow: 'auto'});
        $('.case-list').css('height', $('#case').height() - 33 + 'px');
        $('.introCase').css('height',$('.listDiv').height() - $('.minH').height() - 5 + 'px');
        //附件查看
        $('#fileImg').css({width:$('.infoL').width() - 500 + 'px',overflow: 'hidden'});

        //上传
        $('.fileContainer').css('width',$('.fileEnclosures').width() - 35 + 'px');
        $('#yulan').css({width: $('.fileContainer').width() - 405 + 'px', height: $('.fileEnclosures .left').height() + 'px'});
        if(imgArray.length > 0){
            $('#canvasShow').css({width:($('.fileContainer').width() - 405) * imgArray.length + 'px', height: $('.fileEnclosures .left').height()+ 'px'});
        } else {
            $('#canvasShow').css({width:$('.fileContainer').width() - 405 + 'px', height: $('.fileEnclosures .left').height() + 'px'});
        }
        $('#canvasShow img').css({width:$('.fileContainer').width() - 405 + 'px', height: $('.fileEnclosures .left').height() + 'px'});
        $('#canvasShow canvas').css({width:$('.fileContainer').width() - 405 + 'px', height: $('.fileEnclosures .left').height() + 'px'});
        $('.allMessageList').css('width',$('.fileEnclosures .right').width() + 'px');
        $('#canvasShow').css('margin-left', - $('#yulan').width() * nowIndex);
        $('.lineSurvey').css({height: $('.tab-1').height() - 90 + 'px',overflow: 'auto'});
    })
    //日期
    laydate.render({
        elem: '#startDate',
        type: 'date',
        range: '~',
        theme: 'molv',//主题
        min: '1900-1-1 00:00:00',
        max: 0,
        format: 'yyyy-MM-dd',
        done: function(value, date, endDate){
        }
    });

    //填数据
    //发型
    $('#fxs').append('<option value="">请选择</option>');
    for(var i = 0; i < data.fx.length; i++){
        $('#fxs').append('<option value="'+ data.fx[i] +'">'+ data.fx[i] +'</option>');
    }

    //衣服颜色
    $('#yzyss').append('<option value="">请选择</option>');
    for(var i = 0; i < data.yzys.length; i++){
        $('#yzyss').append('<option value="'+ data.yzys[i] +'">'+ data.yzys[i] +'</option>');
    }

    //脸型
    $('#lxs').append('<option value="">请选择</option>');
    for(var i = 0; i < data.lx.length; i++){
        $('#lxs').append('<option value="'+ data.lx[i] +'">'+ data.lx[i] +'</option>');
    }

    //体型
    $('#txs').append('<option value="">请选择</option>');
    for(var i = 0; i < data.tx.length; i++){
        $('#txs').append('<option value="'+ data.tx[i] +'">'+ data.tx[i] +'</option>');
    }

    //车身颜色
    // $('#cpys').append('<option value="">请选择</option>');
    // $('#cpyss').append('<option value="">请选择</option>');
    // for(var i = 0; i < data.cpys.length; i++){
    //     $('#cpys').append('<option value="'+ data.cpys[i] +'">'+ data.cpys[i] +'</option>');
    //     $('#cpyss').append('<option value="'+ data.cpys[i] +'">'+ data.cpys[i] +'</option>');
    // }

    //是否套牌
    // $('#sftp').append('<option value="">请选择</option>');
    // $('#sftps').append('<option value="">请选择</option>');
    // for(var i = 0; i < data.sftp.length; i++){
    //     $('#sftp').append('<option value="'+ data.sftp[i] +'">'+ data.sftp[i] +'</option>');
    //     $('#sftps').append('<option value="'+ data.sftp[i] +'">'+ data.sftp[i] +'</option>');
    // }

    //车辆特征
    // $('#cltz').append('<option value="">请选择</option>');
    // $('#cltzs').append('<option value="">请选择</option>');
    // for(var i = 0; i < data.cltz.length; i++){
    //     $('#cltz').append('<option value="'+ data.cltz[i] +'">'+ data.cltz[i] +'</option>');
    //     $('#cltzs').append('<option value="'+ data.cltz[i] +'">'+ data.cltz[i] +'</option>');
    // }

    //作案工具
    $('#zagjs').append('<option value="">请选择</option>');
    for(var i = 0; i < data.zagj.length; i++){
        $('#zagjs').append('<option value="'+ data.zagj[i].tool +'">'+ data.zagj[i].tool +'</option>');
    }

    //车辆类型
    // $('#cllx').append('<option value="">请选择</option>');
    // $('#cllxs').append('<option value="">请选择</option>');
    // for(var i = 0; i < data.cllx.length; i++){
    //     $('#cllx').append('<option value="'+ data.cllx[i] +'">'+ data.cllx[i] +'</option>');
    //     $('#cllxs').append('<option value="'+ data.cllx[i] +'">'+ data.cllx[i] +'</option>');
    // }

    //车辆型号
    // $('#clxh').append('<option value="">请选择</option>');
    // $('#clxhs').append('<option value="">请选择</option>');
    // for(var i = 0; i < data.clxh.length; i++){
    //     $('#clxh').append('<option value="'+ data.clxh[i] +'">'+ data.clxh[i] +'</option>');
    //     $('#clxhs').append('<option value="'+ data.clxh[i] +'">'+ data.clxh[i] +'</option>');
    // }


    $.ajax({
        type: 'get',
        url: baseUrls + 'dict/ajlx',
        beforeSend: function(){
            Loading();
        },
        success: function(response){
            closeLoading();
            if(response.responseCode == '1000'){
                if(response.content.length > 0){
                    for(var i = 0; i< response.content.length; i++){
                        $('#ajlx').append('<option value="'+ response.content[i].code +'">'+ response.content[i].name +'</option>')
                    }
                }
            } else{
                Msg('案件类型获取失败');
            }
        },
        error: function(){
            closeLoading();
            Msg('案件类型获取失败');
        }
    })
    $.ajax({
        type: 'get',
        url: baseUrls + 'commandStore/list',
        data: {userid: $('#userId').val()},
        beforeSend: function(){
            Loading();
        },
        success: function(response){
            closeLoading();
            if(response.responseCode == '1000'){
                if(response.content.length > 9){
                    $('.num').text("+9");
                } else{
                    $('.num').text(response.content.length);
                }
                if($('.num').text() == 0){
                    $('.num').text('');
                }
                for(var i = 0; i <response.content.length; i++){
                    addList.push(response.content[i].infonum);
                    $('.ul-contents').append('<li><span class="firstSpan">'+ response.content[i].infonum +'</span><span class="secondSpan">'+ response.content[i].infoname +'</span><span onclick="cleared(this)"><i class=" fa fa-minus" aria-hidden="true"></i></span></li>')
                }
            } else{
             //   Msg('案件类型获取失败');
            }
        },
        error: function(){
            closeLoading();
          //  Msg('案件类型获取失败');
        }
    })
    $('.marks').click(function(){
        $(this).hide();
    })

//取消默认右键事件
    document.oncontextmenu = function(){
        return false;
    }
})
function getMsg(obj){
    Obj = obj;
    $(obj).addClass('liActive').siblings().removeClass('liActive');
    clearMsg();
    clearFile();
    clearLineSurvey();//清除线勘数据
    ajmc = $(obj).children('.secondSpan').html();
    ajbh = $(obj).children('.firstSpan').html();
    $.ajax({
        type: 'get',
        url: baseUrls + 'case/detail',
        data: {
            ajbh: $(obj).children('.firstSpan').html(),
            userid: $('#userId').val()
        },
        beforeSend: function(){
            Loading();
        },
        success: function(response){
            if (response.responseCode == "1000") {
                closeLoading();
                if(response.content.hasAttention == true){
                    $('.inFollow').css('display', 'none');
                    $('.unFollow').css('display', 'block');
                }else{
                    $('.inFollow').css('display', 'block');
                    $('.unFollow').css('display', 'none');
                }
                $('.ajbh-hoof').val(nulls(response.content.aj[0].ajbh));
                $('.afkssj-hoof').val(nulls(response.content.aj[0].afkssj ) + '  ~  ' + nulls(response.content.aj[0].afjssj));
                if(nulls(response.content.aj[0].afkssj ) == "无" && nulls(response.content.aj[0].afjssj) == "无"){
                    $('.afkssj-hoof').val('无');
                }
                $('.ajmc-hoof').val(nulls(response.content.aj[0].ajmc));
                $('.ajlb-hoof').val(nulls(response.content.aj[0].ajlb));
                $('.afdd-hoof').val(nulls(response.content.aj[0].afdd));
                $('.cjr1-hoof').val(nulls(response.content.aj[0].cjr1) + '  ~  ' + nulls(response.content.aj[0].cjr2));
                if(nulls(response.content.aj[0].cjr1) == '无' && nulls(response.content.aj[0].cjr2) == '无'){
                    $('.cjr1-hoof').val('无');
                } else if(nulls(response.content.aj[0].cjr1) == '无'){
                    $('.cjr1-hoof').val(nulls(response.content.aj[0].cjr2));
                } else{
                    $('.cjr1-hoof').val(nulls(response.content.aj[0].cjr1));
                }
                $('.gxr-hoof').val(nulls(response.content.aj[0].aqgjc));
                $('.ajlx-hoof').val(nulls(response.content.aj[0].ajlx));
                $('.jyaq-hoof').html(nulls(response.content.aj[0].jyaq));
                $('.rImg').html('');

                //嫌疑人照片显示
                //轮播
                if(response.content.xyr.length > 0){
                    for(var i = 0; i < response.content.xyr.length; i++){
                        peoplePhoto += '<li><span><img src="'+ response.content.xyr[i].WLLJ +'" onerror="nofind(this)" title="'+ nulls(response.content.xyr[i].NAME) +'" class="sliderImg" alt="" /></span></li>';
                    }
                    $('#xm').bind('dblclick',function(){
                        suspectShow();
                    });
                    $('#xms').bind('dblclick',function(){
                        suspectShow();
                    });
                }else{
                    $('#xm').unbind('dblclick');
                    $('#xms').unbind('dblclick');
                }

                //附件信息
                if(response.content.xs.tp.length > 0){
                    $('.tab-3 h3 .spanLeft').html('线索修改');
                    $('.infos').css({display: 'block'});
                    $('.introCase').css('height', '150px');
                    //案件基本信息 图片
                    var photoLength = 0;
                    for (var i = 0; i < response.content.xs.tp.length; i++) {
                        if(response.content.xs.tp[i].qzlx == 4 && response.content.xs.tp[i].wllj != null){
                            photoLength += 1;
                            $('.rImg').append('<div class="father"><em class="son"><img src="' + response.content.xs.tp[i].wllj + '"  onerror="nofind(this)" class="introImg"></em></div>');
                        }
                        if(photoLength >= 2){
                            break;
                        }
                    }
                    if( $('.rImg').html() == ''){
                        $('.message .msgR').css({flex: '0 0 0', paddingLeft: '0'});
                        $('.rImg').css('padding','0');
                    }else {
                        $('.message .msgR').css({flex: '0 0 500px', paddingLeft: '5px'});
                        $('.rImg').css('padding','5px');
                        $('.rImg').css({height: $('.msgL').height()});
                        $('.father').css({height: Math.floor($('.msgL').height() / 2)});
                        $('.father img').css({maxHeight: Math.floor($('.msgL').height() / 2)});
                    }
                       //附件
                    $('#allImg').html('');
                    $('.allFileMsg').html('');
                    $('#fileImg').css({width:$('.infoL').width() - 500 + 'px',overflow: 'hidden'});
                    for (var i = 0; i < response.content.xs.tp.length; i++) {
                        var fileMsgBuild = '';
                        if(response.content.xs.tp[i].tpylzd7 == '嫌疑人'){
                            var jrspsj = '';
                            if(response.content.xs.tp[i].jrspsj != null && response.content.xs.tp[i].jrspsj.length >= 0){
                                jrspsj = '<div class="group clearfix"><div class="form-group form-groups"><label>视频人物时间</label><input type="text" class="form-control Input" value="'+ nulls(response.content.xs.tp[i].jrspsj) +' ~ '+ nulls(response.content.xs.tp[i].lkspsj) +'" readonly></div></div>';
                            }
                            fileMsgBuild = '<div class=""><div class="group clearfix"><div class="form-group"><label>人数</label><input type="text" class="form-control Input fileOne" value="'+ nulls(response.content.xs.tp[i].rs) +'" readonly></div><div class="form-group"><label>年龄</label><input type="text" class="form-control Input fileTwo" value="'+ nulls(response.content.xs.tp[i].nl) +'" readonly></div></div><div class="group clearfix"><div class="form-group"><label>性别</label><input type="text" class="form-control Input fileThree" value="'+ nulls(response.content.xs.tp[i].xb) +'" readonly></div><div class="form-group"><label>身高</label><input type="text" class="form-control Input fileFour" value="'+ nulls(response.content.xs.tp[i].sg) +'" readonly></div></div><div class="group clearfix"><div class="form-group"><label>上衣颜色</label><input type="text" class="form-control Input fileFive" value="'+ nulls(response.content.xs.tp[i].ssys) +'" readonly></div><div class="form-group"><label>上衣正面</label><input type="text" class="form-control Input fileSix" value="'+ nulls(response.content.xs.tp[i].sszm) +'" readonly></div></div><div class="group clearfix"><div class="form-group"><label>上衣背面</label><input type="text" class="form-control Input fileSeven" value="'+ nulls(response.content.xs.tp[i].ssbm) +'" readonly></div><div class="form-group"><label>上衣侧面</label><input type="text" class="form-control Input fileEight" value="'+ nulls(response.content.xs.tp[i].sscm) +'" readonly></div></div><div class="group clearfix"><div class="form-group form-groups"><label>上衣备注</label><input type="text" class="form-control Input fileEight" value="'+ nulls(response.content.xs.tp[i].ssbz) +'" readonly></div></div><div class="group clearfix"><div class="form-group"><label>下身颜色</label><input type="text" class="form-control Input fileNine" value="'+ nulls(response.content.xs.tp[i].xsys) +'" readonly></div><div class="form-group"><label>下身正面</label><input type="text" class="form-control Input fileTen" value="'+ nulls(response.content.xs.tp[i].xszm) +'" readonly></div></div><div class="group clearfix"><div class="form-group"><label>下身背面</label><input type="text" class="form-control Input fileEleven" value="'+ nulls(response.content.xs.tp[i].xsbm) +'" readonly></div><div class="form-group"><label>下身侧面</label><input type="text" class="form-control Input fileTwelve" value="'+ nulls(response.content.xs.tp[i].xscm) +'" readonly></div></div><div class="group clearfix"><div class="form-group form-groups"><label>下身备注</label><input type="text" class="form-control Input fileThirteen" value="'+ nulls(response.content.xs.tp[i].xsbz) +'" readonly></div></div><div class="group clearfix"><div class="form-group"><label>鞋颜色</label><input type="text" class="form-control Input fileFourteen" value="'+ nulls(response.content.xs.tp[i].xys) +'" readonly></div><div class="form-group"><label>嫌疑人状态</label><input type="text" class="form-control Input filefifteen" value="'+ nulls(response.content.xs.tp[i].xyrzt) +'" readonly></div></div>'+ jrspsj +'</div>';
                        }else if(response.content.xs.tp[i].tpylzd7 == '车辆') {
                            fileMsgBuild = '<div class=""><div class="group clearfix"><div class="form-group"><label>车辆颜色</label><input type="text"class="form-control Input fileOne" value="'+ nulls(response.content.xs.tp[i].csys) +'" readonly></div><div class="form-group"><label>型号</label><input type="text"class="form-control Input fileTwo" value="'+ nulls(response.content.xs.tp[i].cllx) +'"  readonly></div></div><div class="group clearfix"><div class="form-group"><label>二轮车</label><input type="text"class="form-control Input fileThree" value="'+ nulls(response.content.xs.tp[i].elc) +'" readonly></div><div class="form-group"><label>二轮车颜色</label><input type="text"class="form-control Input fileFour" value="'+ nulls(response.content.xs.tp[i].elcys) +'" readonly></div></div><div class="group clearfix"><div class="form-group form-groups"><label>车牌</label><input type="text" class="form-control Input fileFive" value="'+ nulls(response.content.xs.tp[i].cphm) +'" readonly></div></div></div>';
                        }else if(response.content.xs.tp[i].tpylzd7 == '损失物品'){
                            fileMsgBuild = '<div class=""><div class="group clearfix"><div class="form-group form-groups"><label>损失物品说明</label><input type="text" class="form-control Input fileOne" value="'+ nulls(response.content.xs.tp[i].sswp) +'" readonly></div></div></div>';
                        }else{
                            fileMsgBuild = '<div class=""><div class="group clearfix"><div class="form-group form-groups"><label>缴获物品说明</label><input type="text" class="form-control Input fileOne"  value="'+ nulls(response.content.xs.tp[i].jhwp) +'" readonly></div></div></div>';
                        }
                        if(response.content.xs.tp[i].qzlx == 1){
                            $('#allImg').append('<img src="thread/img/video.jpg" onerror="nofind(this)" >');
                            $('.allFileMsg').append('<div class="fileMsg"><div class="group clearfix"><div class="form-group form-groups"><label>文件说明</label><input type="text" class="form-control Input" readonly value="' + nulls(response.content.xs.tp[i].tpylzd7) + '"></div></div><div class="group clearfix"><div class="form-group form-groups"> <label>补录信息</label><div class="enclosureT">'+ fileMsgBuild +'</div><a href="' + baseUrls + 'download?url=' + response.content.xs.tp[i].wllj + '" target="_blank" class="btn btn-success downLoad" >附件下载</a><input type="hidden" value="' + response.content.xs.tp[i].gxlj + '"></div></div></div>');
                        }
                        if(response.content.xs.tp[i].qzlx == 4){
                            $('#allImg').append('<img src="' + response.content.xs.tp[i].wllj + '" onerror="nofind(this)" ondblclick="openImg(\'' + response.content.xs.tp[i].wllj + '\')" style="cursor:pointer;">');
                            $('.allFileMsg').append('<div class="fileMsg"><div class="group clearfix"><div class="form-group form-groups"><label>文件说明</label><input type="text" class="form-control Input" readonly value="' + nulls(response.content.xs.tp[i].tpylzd7) + '"></div></div><div class="group clearfix"><div class="form-group form-groups"> <label>补录信息</label><div class="enclosureT">'+ fileMsgBuild +'</div><a href="' + baseUrls + 'download?url=' + response.content.xs.tp[i].wllj + '" target="_blank" class="btn btn-success downLoad">附件下载</a><input type="hidden" value="' + response.content.xs.tp[i].gxlj + '"></div></div></div>');
                        }
                        if(response.content.xs.tp[i].qzlx == 5){
                            $('#allImg').append('<img src="thread/img/other.jpg" onerror="nofind(this)" >');
                            $('.allFileMsg').append('<div class="fileMsg"><div class="group clearfix"><div class="form-group form-groups"><label>文件说明</label><input type="text" class="form-control Input" readonly value="' + nulls(response.content.xs.tp[i].tpylzd7) + '"></div></div><div class="group clearfix"><div class="form-group form-groups"> <label>补录信息</label><div class="enclosureT">'+ fileMsgBuild +'</div><a href="' + baseUrls + 'download?url=' + response.content.xs.tp[i].wllj + '" target="_blank" class="btn btn-success downLoad">附件下载</a><input type="hidden" value="' + response.content.xs.tp[i].gxlj + '"></div></div></div>');
                        }
                    };
                    imgNum = $('#allImg img').length;
                    $('.allImg img').css({width: $('#fileImg').width(),height: '300px'});
                    $('.allImg').css('width', $('.images').width() * imgNum + 'px');
                    $('.allFileMsg ').css('width', 500 * $('.allImg img').length + 'px');
                    $('.fileMsg').css({width: '500px'});
                }

                //线索数据填充
                if(response.content.xs.wz.length > 0){
                    $('.infos').css({display: 'block'});
                    $('.introCase').css('height','150px');
                    //案件存在线索读取线索内现勘数据
                    // 基本信息
                     //线索基本
                    $('#ajqy').val(nulls(response.content.xs.wz[0].ajqy));
                    $('#qzmc').val(nulls(response.content.xs.wz[0].qzmc));
                    $('#zagj').val(nulls(response.content.xs.wz[0].zagjms));
                    $('#sjh').val(nulls(response.content.xs.wz[0].sjh));
                    $('#sjsbh').val(nulls(response.content.xs.wz[0].sjsbh));
                    $('#xm').val(nulls(response.content.xs.wz[0].xm));
                    $('#fx').val(nulls(response.content.xs.wz[0].fx));
                    $('#yzys').val(nulls(response.content.xs.wz[0].yzys));
                    $('#lx').val(nulls(response.content.xs.wz[0].lx));
                    $('#tx').val(nulls(response.content.xs.wz[0].tx));
                    $('#bz').val(nulls(response.content.xs.wz[0].bz));
                    $('#bzs').val(nulls(response.content.xs.wz[0].bz));
                      //线勘
                    $('#xzdxClue1').val(nulls(response.content.xs.wz[0].xzdxmsxl));
                    $('#xzdxClueDl1').val(nulls(response.content.xs.wz[0].xzdxms));
                    $('#zaddClue1').val(nulls(response.content.xs.wz[0].zadd));
                    $('#zasdClue1').val(nulls(response.content.xs.wz[0].zasdmsxl));
                    $('#zasdClueDl1').val(nulls(response.content.xs.wz[0].zasdms));
                    $('#qrflClue1').val(nulls(response.content.xs.wz[0].qrfsmsxl));
                    $('#qrflClueDl1').val(nulls(response.content.xs.wz[0].qrfsms));
                    $('#zackClue1').val(nulls(response.content.xs.wz[0].zackms));
                    $('#zarkClue1').val(nulls(response.content.xs.wz[0].zajkms));
                       //损失物品
                    $('#sl').val(nulls(response.content.xs.wz[0].sl));
                    $('#jzy').val(nulls(response.content.xs.wz[0].jzy));
                    $('#pm').val(nulls(response.content.xs.wz[0].pm));
                    $('#cp').val(nulls(response.content.xs.wz[0].cp));
                    $('#xh').val(nulls(response.content.xs.wz[0].xhxk));
                    $('#tzms').val(nulls(response.content.xs.wz[0].tzmsxk));


                    //录入信息
                    $('#ajqys').val(nulls(response.content.xs.wz[0].ajqy));
                    $('#zagjs').val(nulls(response.content.xs.wz[0].zagjms));
                    $('#sjhs').val(nulls(response.content.xs.wz[0].sjh));
                    $('#sjsbhs').val(nulls(response.content.xs.wz[0].sjsbh));
                    $('#xms').val(nulls(response.content.xs.wz[0].xm))
                    $('#fxs').val(nulls(response.content.xs.wz[0].fx));
                    $('#yzyss').val(nulls(response.content.xs.wz[0].yzys));
                    $('#lxs').val(nulls(response.content.xs.wz[0].lx));
                    $('#txs').val(nulls(response.content.xs.wz[0].tx));
                      //现勘
                    $('#chooseShowOne').val(nulls(response.content.xs.wz[0].xzdxmsxl));
                    $('#chooseHideOne').val(nulls(response.content.xs.wz[0].xzdxmsxl));
                    $('#xzdxms').val(nulls(response.content.xs.wz[0].xzdxms));

                    $('#zadd').val(nulls(response.content.xs.wz[0].zadd));

                    $('#chooseShowTwo').val(nulls(response.content.xs.wz[0].zasdmsxl));
                    $('#chooseHideTwo').val(nulls(response.content.xs.wz[0].zasdmsxl));
                    $('#zasdms').val(nulls(response.content.xs.wz[0].zasdms));

                    $('#chooseShowThree').val(nulls(response.content.xs.wz[0].qrfsmsxl));
                    $('#chooseHideThree').val(nulls(response.content.xs.wz[0].qrfsmsxl));
                    $('#qrfsms').val(nulls(response.content.xs.wz[0].qrfsms));

                    $('#zack').val(nulls(response.content.xs.wz[0].zackms));
                    $('#zark').val(nulls(response.content.xs.wz[0].zajkms));
                    //损失物品
                    $('#sls').val(nulls(response.content.xs.wz[0].sl));
                    $('#jzys').val(nulls(response.content.xs.wz[0].jzy));
                    $('#pms').val(nulls(response.content.xs.wz[0].pm));
                    $('#cps').val(nulls(response.content.xs.wz[0].cp));
                    $('#xhs').val(nulls(response.content.xs.wz[0].xhxk));
                    $('#tzmss').val(nulls(response.content.xs.wz[0].tzmsxk));


                }else{
                    //读取现勘内现勘数据
                     //现勘
                    if(response.content.xk.fx.length > 0){
                        $('.infos').css({display: 'block'});
                        $('.introCase').css('height','150px');
                        $('#xzdxClue1').val(nulls(response.content.xk.fx[0].xzdxms));
                        $('#xzdxClueDl1').val(nulls(response.content.xk.fx[0].xzdxms));
                        $('#zaddClue1').val(nulls(response.content.xk.fx[0].zadd));
                        $('#zasdClue1').val(nulls(response.content.xk.fx[0].zasdms));
                        $('#zasdClueDl1').val(nulls(response.content.xk.fx[0].zasdms));
                        $('#qrflClue1').val(nulls(response.content.xk.fx[0].qrfsms));
                        $('#qrflClueDl1').val(nulls(response.content.xk.fx[0].qrfsms));
                        $('#zackClue1').val(nulls(response.content.xk.fx[0].zackms));
                        $('#zarkClue1').val(nulls(response.content.xk.fx[0].zajkms));

                        // 录入
                        $('#chooseShowOne').val(nulls(response.content.xk.fx[0].xzdxms));
                        $('#chooseHideOne').val(nulls(response.content.xk.fx[0].xzdxms));
                        $('#xzdxms').val(nulls(response.content.xk.fx[0].xzdxms));

                        $('#zadd').val(nulls(response.content.xk.fx[0].zadd));

                        $('#chooseShowTwo').val(nulls(response.content.xk.fx[0].zasdms));
                        $('#chooseHideTwo').val(nulls(response.content.xk.fx[0].zasdms));
                        $('#zasdms').val(nulls(response.content.xk.fx[0].zasdms));

                        $('#chooseShowThree').val(nulls(response.content.xs.wz[0].qrfsms));
                        $('#chooseHideThree').val(nulls(response.content.xs.wz[0].qrfsms));
                        $('#qrfsms').val(nulls(response.content.xs.wz[0].qrfsms));

                        $('#zack').val(nulls(response.content.xs.wz[0].zackms));
                        $('#zark').val(nulls(response.content.xs.wz[0].zajkms));
                    }
                    //物品
                    if(response.content.xk.wp.length > 0){
                        $('.infos').css({display: 'block'});
                        $('.introCase').css('height','150px');
                        $('#sl').val(nulls(response.content.xk.wp[0].sl));
                        $('#jzy').val(nulls(response.content.xk.wp[0].jzy));
                        $('#pm').val(nulls(response.content.xk.wp[0].pm));
                        $('#cp').val(nulls(response.content.xk.wp[0].cp));
                        $('#xh').val(nulls(response.content.xk.wp[0].xh));
                        $('#tzms').val(nulls(response.content.xk.wp[0].tzms));

                        //录入
                        $('#sls').val(nulls(response.content.xs.wz[0].sl));
                        $('#jzys').val(nulls(response.content.xs.wz[0].jzy));
                        $('#pms').val(nulls(response.content.xs.wz[0].pm));
                        $('#cps').val(nulls(response.content.xs.wz[0].cp));
                        $('#xhs').val(nulls(response.content.xs.wz[0].xhxk));
                        $('#tzmss').val(nulls(response.content.xs.wz[0].tzmsxk));
                    }
                }
            } else {
                closeLoading();
                Msg();
            }
        },
        error:function(){
            closeLoading();
            Msg();
        }
    })
}
function btnClick(item, num){
    clearMsg();
    clearFile();
    clearLineSurvey();//清除线勘数据
    $('.message .msgR').css({flex: '0 0 0', paddingLeft: '0'});
    $('.rImg').css('padding','0');
    var parames = '',
        xq = '';
    $(item).addClass('btn-active').removeClass('btn-normal');
    $(item).siblings().addClass('btn-normal').removeClass('btn-active');
    var nums = Math.floor(($('#case').height() - $('.case-title').height() - $('.case-footer').height() - 33)/35);
    //关注按钮初始化
    $('.inFollow').css('display', 'block');
    $('.unFollow').css('display', 'none');
    //判断是否为普通用户 本地检索判断
    if($('#roleEnName').val() == 'ptyh'){
        xq = $('#myArea').val().substring(0,6);
    }
    if(num == '0'){
        parames = {pageIndex: 1, pageSize: nums, ssxq: $('#myArea').val(), xq: xq};
    } else{
        parames = {pageIndex: 1, pageSize: nums,xq: xq};
    }
    $('#mation').ajaxSubmit({
        type: 'get',
        url: baseUrls + 'case/list',
        data: parames,
        beforeSend: function(){
            Loading();
        },
        success: function(response){
            closeLoading();
            $('.ul-content').html('');
            $('#pagination1').html('');
            //分页器
            if(response.responseCode == '1000'){
                if(response.content.pages > 0){
                    if(response.content.list.length > 0){
                        for(var i = 0; i< response.content.list.length; i++){
                            if(response.content.list[i].status == '1'){
                                $('.ul-content').append('<li onclick="getMsg(this)" onmouseup="shopping(this)" class="hasClue"  title="鼠标右键添加指令相关案件"><span class="firstSpan left">'+  nulls(response.content.list[i].ajbh) +'</span><span class="secondSpan center">'+ nulls(response.content.list[i].ajmc) +'</span><span class="right">'+ nulls(response.content.list[i].afkssj) +'</span></li>');
                            }else{
                                $('.ul-content').append('<li onclick="getMsg(this)" onmouseup="shopping(this)"  title="鼠标右键添加指令相关案件"><span class="firstSpan left">'+ nulls(response.content.list[i].ajbh) +'</span><span class="secondSpan center">'+ nulls(response.content.list[i].ajmc) +'</span><span class="right">'+ nulls(response.content.list[i].afkssj) +'</span></li>');
                            }
                        }
                    };
                    getMsg($('.ul-content li').eq(0));
                    $('#demo_pag1').bs_pagination({
                        totalPages: response.content.pages,
                        visiblePageLinks: 6,
                        currentPage: response.content.pageNum,
                        showGoToPage: false,
                        showRowsPerPage: false,
                        showRowsInfo: false,
                        showRowsDefaultInfo: false,
                        navListContainerClass: 'col-xs-12',
                        onChangePage: function (event, data) {
                            clearMsg();
                            clearFile();
                            clearLineSurvey();//清除线勘数据
                            //关注按钮初始化
                            $('.inFollow').css('display', 'block');
                            $('.unFollow').css('display', 'none');
                            $("#mation").ajaxSubmit({
                                type: 'get',
                                url: baseUrls + 'case/list',
                                data: {
                                    pageIndex: data.currentPage,
                                    pageSize: nums
                                },
                                beforeSend: function(){
                                    Loading();
                                },
                                success: function(response){
                                    closeLoading();
                                    if(response.responseCode == '1000'){
                                        $('.ul-content').html('');
                                        if(response.content.list.length > 0){
                                            for(var i = 0; i< response.content.list.length; i++){
                                                if(response.content.list[i].status == '1'){
                                                    $('.ul-content').append('<li onclick="getMsg(this)" onmouseup="shopping(this)" class="hasClue"><span class="firstSpan left">'+ nulls(response.content.list[i].ajbh) +'</span><span class="secondSpan center">'+ nulls(response.content.list[i].ajmc) +'</span><span class="right">'+ nulls(response.content.list[i].afkssj) +'</span></li>');
                                                }else{
                                                    $('.ul-content').append('<li onclick="getMsg(this)" onmouseup="shopping(this)"><span class="firstSpan left">'+ nulls(response.content.list[i].ajbh) +'</span><span class="secondSpan center">'+ nulls(response.content.list[i].ajmc) +'</span><span class="right">'+ nulls(response.content.list[i].afkssj) +'</span></li>');
                                                }
                                            }
                                            getMsg($('.ul-content li').eq(0));
                                        } else {
                                            $('.ul-content').html('<h3 class="noMsgs">暂无数据</h3>');
                                            $('#demo_pag1').html('');
                                        }
                                    } else{
                                        Msg();
                                    }
                                }
                            })
                        }
                    })
                } else{
                    $('.ul-content').html('');
                    $('#demo_pag1').html('');
                    closeLoading();
                }
            } else{
                $('.ul-content').html('');
                $('#demo_pag1').html('');
                closeLoading();
            }
        },
        error: function(){
            closeLoading();
            Msg('服务端异常，请稍后再试！');

        }
    })
}
function nulls(item){
    var callback;
    if(item != null && item != undefined){
        callback = item;
    } else {
        callback = '无';
    }
    return callback;
}
function Nulls(item){
    var callback;
    if(item != null && item != undefined){
        callback = item;
    } else {
        callback = '';
    }
    return callback;
}
function changeHeight(item,num){
    line = num;
    $(item).parent().stop().animate({
        height: h - 62
    },500)
    $(item).parent().siblings().stop().animate({
        height: '50px'
    },500)
    $(item).find('.arrowDirection').attr('src','thread/img/down.png');
    $(item).parent().siblings().find('.arrowDirection').attr('src','thread/img/right.png');
}
function getAjlb(item){
    if($(item).val() != ''){
        $.ajax({
            type: 'get',
            url: baseUrls + 'dict/ajlb',
            data: {code: $(item).val()},
            beforeSend: function(){
                Loading();
            },
            success: function(response){
                closeLoading();
                if(response.responseCode == '1000'){
                    $('#ajlb').html('');
                    $('#ajlb').html('<option value="">请选择</option>');
                    if(response.content.length > 0){
                        for(var i = 0; i< response.content.length; i++){
                            $('#ajlb').append('<option value="'+ response.content[i].code +'">'+ response.content[i].name +'</option>')
                        }
                    }
                } else {
                    Msg('小案类别获取失败');
                }
            },
            error:function(){
                closeLoading();
            }
        })
    } else{
        $('#ajlb').html('');
        $('#ajlb').html('<option value="">请选择</option>');
    }
}
function clearMsg(){
    qzbhs = '';
    xxid = '';
    xh = '';
    ajbh = '';
    ajmc = '';

    //初始化右侧
    $('.infos').css({display: 'none'});
    $('.introCase').css('height',$('.listDiv').height() - $('.minH').height() - 5 + 'px');
    $('.tab-3 h3 .spanLeft').html('线索录入');
    //清除案件基本信息
    $('.ajbh-hoof').val('');
    $('.afkssj-hoof').val('');
    $('.ajmc-hoof').val('');
    $('.ajlb-hoof').val('');
    $('.afkssj-hoof').val('');
    $('.afdd-hoof').val('');
    $('.cjr1-hoof').val('');
    $('.gxr-hoof').val('');
    $('.ajlx-hoof').val('');
    $('.afjssj-hoof').val('');
    $('.cjr2-hoof').val('');
    $('.jyaq-hoof').html('');
    $('.rImg').html('');
    $('.message .msgR').css({flex: '0 0 0', paddingLeft: '0'});
    $('.rImg').css('padding','0');
    //清除线索信息
    $('#allImg').html('');
    $('.allFileMsg').html('');
    $('#allImg').append('<img src="common/img/nothing.png" alt="图片丢失" onerror="nofind(this)">');
    $('.allFileMsg').append('<div class="fileMsg fileTextMsg"><div class="group clearfix"><div class="form-group form-groups"><label>文件说明</label><input type="text" class="form-control Input" readonly value=""></div></div><div class="group clearfix"><div class="form-group form-groups"> <label>补录</label><textarea class="form-control enclosureT" readonly ></textarea></div></div></div>');
    $('.fileMsg').css('width', $('.infoR').width() + 'px');
    $('.allFileMsg').css('width', $('.infoR').width() * $('.fileMsg').length + 'px');
    $('.allFileMsg ').css('margin-left', 0);
    $('.allImg').css('margin-left', 0);
    $('.infos').css({display: 'none'});
    imgNum = 0;

    $('#ajqy').val('');
    $('#qzmc').val('');
    $('#zagj').val('');
    $('#gjsm').val('');
    $('#sjsbh').val('');
    $('#sjh').val('');
    $('#xm').val('');
    $('#fx').val('');
    $('#yzys').val('');
    $('#lx').val('');
    $('#tx').val('');

    $('#xzdxClue1').val('');
    $('#xzdxClueDl1').val('');
    $('#zaddClue1').val('');
    $('#zasdClue1').val('');
    $('#zasdClueDl1').val('');
    $('#qrflClue1').val('');
    $('#qrflClueDl1').val('');
    $('#zarkClue1').val('');
    $('#zackClue1').val('');

    $('#sl').val('');
    $('#jzy').val('');
    $('#pm').val('');
    $('#cp').val('');
    $('#xh').val('');
    $('#tzms').val('');
    $('#bz').val('');
    clueAdd();
}
function clueAdd(){
    //清除新增线索
    $('#ajqys').find("option:first-child").prop("selected", 'selected');
    $('#zagjs').val('');
    $('#gjsms').val('');
    $('#sjhs').val('');
    $('#sjsbhs').val('');
    $('#xms').val('');
    $('#fxs').find("option:first-child").prop("selected", 'selected');
    $('#yzyss').find("option:first-child").prop("selected", 'selected');
    $('#lxs').find("option:first-child").prop("selected", 'selected');
    $('#txs').find("option:first-child").prop("selected", 'selected');
    $('#bzs').val('');

    //现勘
    $('#chooseShowOne').val('');
    $('#chooseHideOne').val('');
    $('#xzdxms').val('');
    $('#xzdx').find("option:first-child").prop("selected", 'selected');;

    $('#zadd').val('');

    $('#chooseShowTwo').val('');
    $('#chooseHideTwo').val('');
    $('#zasdms').val('');
    $('#zasd').find("option:first-child").prop("selected", 'selected');;

    $('#chooseShowThree').val('');
    $('#chooseHideThree').val('');
    $('#qrfsmxl').val('');
    $('#qrfs').find("option:first-child").prop("selected", 'selected');;

    $('#zack').find("option:first-child").prop("selected", 'selected');;
    $('#zark').find("option:first-child").prop("selected", 'selected');;
    //损失物品
    $('#sls').val('');
    $('#jzys').val('');
    $('#pms').val('');
    $('#cps').val('');
    $('#xhs').val('');
    $('#tzmss').val('');
}
function showList(){
    $('#remark').css('display','block');
    $('.shoppingList').animate({
        width: '80%',
        height: '500px',
        marginTop: '-250px'
    },500);
    setTimeout(function(){
        $('#remark .button').css('display','block');
    },500)
}
function hideList(){
    $('#remark .button').css('display','none');
    $('.shoppingList').animate({
        width: 0,
        height: 0,
        marginTop: 0
    },500);
    setTimeout(function(){
        $('#remark').css('display','none');
    },500)
}
function openImg(src){
    $('.marks').html('');
    $('.marks').css('display','table');
    $('.marks').append('<span style="display:table-cell;vertical-align: middle;"><img src="'+ src +'" alt="图片丢失"  onerror="nofind(this)" class="addImg"></span>');
}
function nofind(item){
    item.src = 'common/img/nothing.png';
    item.onerror = null;
}
function stopP(event){
    var e = arguments.callee.caller.arguments[0]||event;
    if (e && e.stopPropagation) {
        e.stopPropagation();
    } else if (window.event) {
        window.event.cancelBubble = true;
    }
}
//现勘数据textarea
function textarea(item){
    $(item).parent().find('pre').html($(item).val());
    $(item).css({height: $(item).parent().find('pre').height() + 'px'});
    $(item).parent().find('label').css({height: $(item).parent().find('pre').height() + 'px',lineHeight: $(item).parent().find('pre').height() + 'px'})
}
function textareaOnload(){
    var Textarea = document.getElementsByClassName('Textarea');
    for(var i = 0; i < Textarea.length; i++){
        $('.Textarea').eq(i).parent().find('label').css({height: $('.Textarea').eq(i).height() + 'px', lineHeight: $('.Textarea').eq(i).height() + 'px'});
    }
}
function clearLineSurvey(){
    $('.listTitleUl li').eq(0).removeClass('liNormal').addClass('liActive').siblings().removeClass('liActive').addClass('liNormal');
    $('.listDiv>div').css('display','none');
    $('.listDiv>div').eq(0).css('display','block');
    $('.listDiv>div').eq(0).children('.message').css('display','flex');

    $('.caseTarget-hoof').val('');
    $('.caseTargetAdress-hoof').val('');
    $('.caseTargetTime-hoof').val('');
    $('.caseTacaseTargetEntrancerget-hoof').val('');
    $('.caseTargetHands-hoof').val('');

    $('.caseInquest-hoof').val('');
    $('.caseAddress-hoof').val('');
    $('.caseWeather-hoof').val('');
    $('.caseScene-hoof').val('');
    $('.caseLight-hoof').val('');
    $('.caseFlip-hoof').val('');
    $('.caseProtectTime-hoof').val('');
    $('.caseProtectPeople-hoof').val('');
    $('.caseProtectMode-hoof').val('');
    $('.caseInspect-hoof').val('');
    $('.caseLost-hoof').val('');
    $('.caseReport-hoof').val('');
    $('.caseLegacy-hoof').val('');
    $('.caseSuggest-hoof').val('');
    $('.caseCommand-hoof').val('');
    $('.caseInspectPeople-hoof').val('');
    $('.caseOther-hoof').val('');

    $('.acceptanceNumber-hoof').val('');
    $('.caseNumber-hoof').val('');
    $('.caseStyle-hoof').val('');
    $('.crimeZone-hoof').val('');
    $('.caseAdress-hoof').val('');
    $('.caseTime-hoof').val('');
    $('.caseHomicide-hoof').val('');
    $('.caseCriminal-hoof').val('');
    $('.caseSolveTime-hoof').val('');
    $('.latitudeLongitude-hoof').val('');
    $('.caseProcess-hoof').val('');

    $('.goodsContent-hoof').html('');
    $('.witnessContent-hoof').html('');
}

//嫌疑人展示
function suspectShow(){
    layer.open({
        title: '嫌疑人详情',
        type: 1,
        skin: 'layui-layer-rim', //加上边框
        area: ['90%', '80%'], //宽高
        scrollbar: false,
        move: false,
        content: '<ul class="diaporama1">'+ peoplePhoto +'</ul>',
        success: function (layero, index) {
            $(".diaporama1").jDiaporama({
                auto: false,
                currentimage:false,//计数器
                infos:true,//标题显示
                animationSpeed: "slow",
                delay: 5000,
                onrollover: false//鼠标悬停显示信息
            });
        },
        cancel: function(index, layero){
            layer.closeAll();
        }
    });
}